package com.team.controller;

import com.team.service.DiseaseService;
import com.team.service.ReservationService;
import com.team.util.WebUtil;
import com.team.vo.Result;
import com.team.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * -*- coding:utf-8 -*-
 *
 * @author 太阳偷渡青山
 * @software IntelliJ IDEA
 * @date 2022/10/24 12:15
 * @Description
 */
@RestController
@RequestMapping("/ReservationQian")
public class ReservationQianController {
    @Autowired
    private ReservationService reservationService;

    @RequestMapping("toCancel")
    public Result toCancel(@RequestBody UserVo userVo){
        return reservationService.toCancel(userVo);
    }

    @RequestMapping("cancelList")
    public Result cancelList(){
        UserVo  userVo = (UserVo) WebUtil.getSession().getAttribute("user");
        return reservationService.toCancel(userVo);
    }

    @RequestMapping("quitCancel")
    public Result quitCancel(){
        return reservationService.quitCancel();
    }

    @RequestMapping("cancel")
    public Result cancel(Integer id){
        return reservationService.cancel(id);
    }

    @RequestMapping("/queryByNameAndIDcard")
    public Result queryByNameAndIDcard(@RequestBody UserVo userVo){
        return reservationService.queryByNameAndIDCard(userVo);
    }

    @RequestMapping("queryList")
    public Result queryList(){
        UserVo  userVo = (UserVo) WebUtil.getSession().getAttribute("user");
        return reservationService.queryByNameAndIDCard(userVo);
    }

    @Autowired
    private DiseaseService diseaseService;
    /**@author:chh
     * 选择被消除
     * @param reservationId 预订id
     * @return {@link Result}
     */
    @RequestMapping("/selectByReservationId")
    public Result selectByRid(int reservationId){
        return diseaseService.selectByReservationId(reservationId);
    }

}
